﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text;

namespace Lifang.Dao
{
    public class SqlNote
    {
        private readonly string _programmeStr;

        /// <summary>SQL注释</summary>
        /// <param name="caller">调用者</param>
        /// <param name="note">对sql的备注如:查询订单列表</param>        
        public SqlNote(string caller, string note)
        {
            Caller = caller;
            Note = note;
            StackTrace st = new StackTrace(new StackFrame(1, true));
            StackFrame sf = st.GetFrame(0);
            _programmeStr = ";File:" + sf.GetFileName() + ";Fun:" + sf.GetMethod().Name + " " + sf.GetFileLineNumber();
        }

        /// <summary>调用者</summary>
        public string Caller { get; set; }
        /// <summary>对sql的备注如:查询订单列表</summary>
        public string Note { get; set; }
        public new string ToString()
        {
            return "/*Flat:Author:" + Caller + ";For:" + Note + _programmeStr + "*/\r\n";
        }
    }
}
